package com.jn.erp.wechat.student.api.controller;

import com.jn.erp.common.core.result.AjaxResult;
import com.jn.erp.web.api.interaction.entity.dto.TIntegralDto;
import com.jn.erp.web.api.interaction.entity.vo.TIntegralVo;
import com.jn.erp.web.api.interaction.service.TIntegralService;
import com.jn.erp.wechat.common.api.controller.base.BaseWxAuthController;
import com.jn.erp.wechat.common.api.entity.dto.WxUserDto;
import com.jn.erp.wechat.core.WxTableDataInfo;
import com.jn.erp.wechat.student.api.entity.vo.StudentIntegralVo;
import com.jn.erp.wechat.student.api.service.StudentIntegralService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <pre>
 *  积分
 * </pre>
 *
 * @author sunjiyong
 * @since 2024/12/10 16:18
 */
@AllArgsConstructor
@RestController
@RequestMapping("/wxs/integral")
public class WxsStudenttIntegralController extends BaseWxAuthController {

    @Autowired
    private StudentIntegralService studentIntegralService;

    @Autowired
    private TIntegralService tIntegralService;

    //获取用户信息
    @PostMapping("/studentList")
    @Transactional
    public AjaxResult studentList() {
        //获取登录家长端相关信息
        WxUserDto studentUser = getStudentUser();
        List<StudentIntegralVo> studentIntegralVos = studentIntegralService.studentList(studentUser.getUserId());
        return AjaxResult.success(studentIntegralVos);
    }


    //老师评价列表
    @GetMapping("/listSecond")
    public WxTableDataInfo listSecond(TIntegralVo tIntegralVo) {
        startPage();
        List<TIntegralDto> list = tIntegralService.tIntegralListSecond(tIntegralVo);
        return getWxDataTable(list);
    }
}
